/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ondrej
 */
@Entity
@Table(name = "file_share")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FileShare.findAll", query = "SELECT f FROM FileShare f"),
    @NamedQuery(name = "FileShare.findById", query = "SELECT f FROM FileShare f WHERE f.id = :id"),
    @NamedQuery(name = "FileShare.findByFromDate", query = "SELECT f FROM FileShare f WHERE f.fromDate = :fromDate"),
    @NamedQuery(name = "FileShare.findByEmailTo", query = "SELECT f FROM FileShare f WHERE f.emailTo = :emailTo")})
public class FileShare implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "from_date")
    private Integer fromDate;
    @Size(max = 50)
    @Column(name = "email_to")
    private String emailTo;
    @JoinColumn(name = "PERSON_id", referencedColumnName = "id")
    @ManyToOne
    private Person pERSONid;
    @JoinColumn(name = "FILE_id", referencedColumnName = "id")
    @ManyToOne
    private File fILEid;

    public FileShare() {
    }

    public FileShare(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getFromDate() {
        return fromDate;
    }

    public void setFromDate(Integer fromDate) {
        this.fromDate = fromDate;
    }

    public String getEmailTo() {
        return emailTo;
    }

    public void setEmailTo(String emailTo) {
        this.emailTo = emailTo;
    }

    public Person getPERSONid() {
        return pERSONid;
    }

    public void setPERSONid(Person pERSONid) {
        this.pERSONid = pERSONid;
    }

    public File getFILEid() {
        return fILEid;
    }

    public void setFILEid(File fILEid) {
        this.fILEid = fILEid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FileShare)) {
            return false;
        }
        FileShare other = (FileShare) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.FileShare[ id=" + id + " ]";
    }
    
}
